<template>
	<div class="app-container" @click="suspend">
		<el-table ref="table"  :data="tableData" style="width: 100%;font-size: smaller;" height="280px">
			<el-table-column type="index" label="序号" />
			<el-table-column prop="pubUserName" width="60" label="发布人">
			</el-table-column>
			<el-table-column prop="content" label="公告内容">
			</el-table-column>
			<el-table-column prop="pubDate" width="120" label="发布时间">
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	import {
		getNoticeList
	} from '@/api/notice'

	export default {
		data() {
			return {
				tableData: [],
				timer:{}
			}
		},
		mounted() {
			getNoticeList().then(res => {
				this.tableData = res.list
			});
			const table = this.$refs.table
			const divData = table.bodyWrapper
			this.timer = setInterval(() => {
				divData.scrollTop += 1
				if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
					divData.scrollTop = 0
				}
			}, 100)
		},
		methods:{
			suspend(){
				clearInterval(this.timer)
			}
		}
	}
</script>

<style>
</style>
